import {
    createRouter,
    createWebHistory
} from "vue-router";

const routes = [
    {
        path: "/login",
        name: "Login",
        component: () =>
            import(/* webpackChunkName: "Login" */ "../views/login/Login.vue"),
    },
    {
        path: "/register",
        name: "Register",
        component: () =>
            import(/* webpackChunkName: "Login" */ "../views/login/Register.vue"),
    },
    {
        path: "/shopOwner",
        redirect: "/shopOwner/homePage",
        name: "ShopOwner",
        component: () =>
            import(/* webpackChunkName: "shopOwner" */ "../views/shopOwner/Layout.vue"),
        children: [
            {
                path: "/shopOwner/homePage",
                name: "HomePage",
                component: () =>
                    import(/* webpackChunkName: "shopOwner" */ "../views/shopOwner/homePage")
            },
            {
                path: "/shopOwner/orderList",
                name: "OrderList",
                component: () =>
                    import(/* webpackChunkName: "shopOwner" */ "../views/shopOwner/orderList")
            },
            {
                path: "/shopOwner/mealList",
                name: "MealList",
                component: () =>
                    import(/* webpackChunkName: "shopOwner" */ "../views/shopOwner/mealList")
            },
            {
                path: "/shopOwner/excessive",
                name: "Excessive",
                component: () =>
                    import(/* webpackChunkName: "shopOwner" */ "../views/shopOwner/mealList")
            },
            {
                path: "/shopOwner/shopInfo",
                name: "ShopInfo",
                component: () =>
                    import(/* webpackChunkName: "shopOwner" */ "../views/shopOwner/shopInfo")
            },
            {
                path: "/shopOwner/applyNewShop",
                name: "ApplyNewShop",
                component: () =>
                    import(/* webpackChunkName: "shopOwner" */ "../views/shopOwner/applyNewShop")
            },
            {
                path: "/shopOwner/noticeList",
                name: "NoticeList",
                component: () =>
                    import(/* webpackChunkName: "shopOwner" */ "../views/shopOwner/noticeList")
            }
        ]
    },
    {
        path: "/manager",
        redirect: "/manager/shopManager",
        name: "Manager",
        component: () =>
            import(/* webpackChunkName: "manager" */ "../views/manager/Layout.vue"),
        children: [
            {
                path: "/manager/shopManager",
                name: "ShopManager",
                component: () =>
                    import(/* webpackChunkName: "manager" */ "../views/manager/shopManage")
            },
            {
                path: "/manager/mealManager",
                name: "MealManager",
                component: () =>
                    import(/* webpackChunkName: "manager" */ "../views/manager/mealManage")
            },
            {
                path: "/manager/userManager",
                name: "UserManager",
                component: () =>
                    import(/* webpackChunkName: "manager" */ "../views/manager/userManage")
            },
            {
                path: "/manager/orderManager",
                name: "OrderManager",
                component: () =>
                    import(/* webpackChunkName: "manager" */ "../views/manager/orderManage")
            }
        ]
    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    // history: createWebHashHistory(process.env.BASE_URL),
    routes,
    scrollBehavior: () => ({
        top: 0
    })
});

export default router;